import { AbstractSelectConfig } from 'babylon-lib/pick/selector/config/abstract-select-config';
import { AbstractMesh } from '@babylonjs/core/Meshes/abstractMesh';
import { Helper } from 'babylon-lib/tool/helper';
import { Troop } from '../attachment/troop';


class TroopSelectConfig extends AbstractSelectConfig<Troop> {

    public test(target: Troop): boolean {
        return target instanceof Troop;
    }

    public compare(a: Troop, b: Troop): boolean {
        return a.id === b.id;
    }

    public meshes(target: Troop): AbstractMesh[] {
        return [target.pickMesh];
    }

    public isMeshOfTarget(mesh: AbstractMesh, target: Troop): number {
        return Helper.isChild(mesh, target.container);
    }

}


export { TroopSelectConfig };